package org.jivesoftware.openfire.plugin;

import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.log4j.Logger;
import org.jivesoftware.openfire.util.xsd.PacketIn;
import org.apache.log4j.PropertyConfigurator;

public class Main {
	
	static final Logger logger = Logger.getLogger(Main.class);

	public static void main(String arg[]) {
		
		PropertyConfigurator.configure("/log4j.properties");

		try {
			// http://192.168.2.10:8080/SynchronaService/services/WSInterface
			WSInterfaceStub sample1ServiceStub = new WSInterfaceStub();
			sample1ServiceStub
					._getServiceClient()
					.getOptions()
					.setProperty(Constants.Configuration.TRANSPORT_URL,
							"http://localhost:8080/SynchronaService/services/WSInterface");
			sample1ServiceStub._getServiceClient().getOptions().setProperty(
					HTTPConstants.CHUNKED, Constants.VALUE_FALSE);

			AdminInterface adminData = new AdminInterface();
			OpenfireInterface opi = new OpenfireInterface();
			PacketIn inData = new PacketIn();

			inData.setAdminCommand("ws -start");
			inData.setBody("sdfsdf");
			inData.setUserName("sdfsdfsf");
			adminData.setInDataAdmin(inData);
			AdminInterfaceResponse response = sample1ServiceStub
					.adminInterface(adminData);
			System.out.println(" [ADMIN INFO]"
					+ response.get_return().getExecutionStatus());
		} catch (AxisFault axisFault) {
			axisFault.printStackTrace();
		} catch (java.rmi.RemoteException e) {
			e.printStackTrace();
		}

	}

}
